package be.lioche.soupe.kits;

import java.util.ArrayList;
import java.util.List;

import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import be.lioche.soupe.Main;
import be.lioche.soupe.Spawn;

public class Flash implements Listener{

	public Main plugin;
	public Flash(Main main) {
		this.plugin = main;
	}

	public static void lvl1(Player p){

		ItemStack casque = new ItemStack(Material.PUMPKIN);
		ItemStack plastron = new ItemStack(Material.IRON_CHESTPLATE);
		ItemStack pantalon = new ItemStack(Material.IRON_LEGGINGS);
		ItemStack bottes = new ItemStack(Material.IRON_BOOTS);

		ItemStack epee = new ItemStack(Material.IRON_SWORD);
		ItemStack ender = new ItemStack(Material.ENDER_PEARL, 15);
		ItemStack torch = new ItemStack(Material.REDSTONE_TORCH_ON);
		ItemMeta torchmeta = torch.getItemMeta();
		torchmeta.setDisplayName(ChatColor.RED + "Téléportation");

		List <String> loretorch = new ArrayList<String>();
		loretorch.add("");
		loretorch.add("§fLe rechargement dure 20s !");
		loretorch.add("");

		torchmeta.setLore(loretorch);
		torch.setItemMeta(torchmeta);
		ItemMeta epeemeta = epee.getItemMeta();
		epeemeta.setDisplayName("§f[§cFlash'Sword§f]");
		epee.setItemMeta(epeemeta);
		casque.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 6);
		
		p.getInventory().clear();
		p.getInventory().setHelmet(casque);
		p.getInventory().setLeggings(pantalon);
		p.getInventory().setChestplate(plastron);
		p.getInventory().setBoots(bottes);

		p.getInventory().addItem(epee);
		p.getInventory().addItem(torch);
		p.getInventory().addItem(ender);
		Spawn.givesoupe(p);
		
		p.sendMessage("");
		p.sendMessage(Main.name + "Kit: §cFlash§f | Lvl: §c1§f");
		p.sendMessage("");

		p.setGameMode(GameMode.ADVENTURE);
		p.setHealth(20.0);
		p.setWalkSpeed((float) 0.25);
	}

	public static void lvl2(Player p){

		ItemStack casque = new ItemStack(Material.PUMPKIN);
		ItemStack plastron = new ItemStack(Material.IRON_CHESTPLATE);
		ItemStack pantalon = new ItemStack(Material.IRON_LEGGINGS);
		ItemStack bottes = new ItemStack(Material.IRON_BOOTS);

		ItemStack epee = new ItemStack(Material.IRON_SWORD);
		ItemStack ender = new ItemStack(Material.ENDER_PEARL, 20);
		ItemStack torch = new ItemStack(Material.REDSTONE_TORCH_ON);
		ItemMeta torchmeta = torch.getItemMeta();
		torchmeta.setDisplayName(ChatColor.RED + "Téléportation");

		List <String> loretorch = new ArrayList<String>();
		loretorch.add("");
		loretorch.add("§fLe rechargement dure 20s !");
		loretorch.add("");

		torchmeta.setLore(loretorch);
		torch.setItemMeta(torchmeta);

		epee.addEnchantment(Enchantment.KNOCKBACK, 1);
		casque.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 6);
		bottes.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
		ItemMeta epeemeta = epee.getItemMeta();
		epeemeta.setDisplayName("§f[§cFlash'Sword§f]");
		epee.setItemMeta(epeemeta);

		p.getInventory().clear();
		p.getInventory().setHelmet(casque);
		p.getInventory().setLeggings(pantalon);
		p.getInventory().setChestplate(plastron);
		p.getInventory().setBoots(bottes);

		p.getInventory().addItem(epee);
		p.getInventory().addItem(torch);
		p.getInventory().addItem(ender);
		Spawn.givesoupe(p);
		
		p.sendMessage("");
		p.sendMessage(Main.name + "Kit: §cFlash§f | Lvl: §c2§f");
		p.sendMessage("");

		p.setGameMode(GameMode.ADVENTURE);
		p.setHealth(20.0);
		p.setWalkSpeed((float) 0.3);
	}
	
	public static void lvl3(Player p){

		ItemStack casque = new ItemStack(Material.PUMPKIN);
		ItemStack plastron = new ItemStack(Material.IRON_CHESTPLATE);
		ItemStack pantalon = new ItemStack(Material.IRON_LEGGINGS);
		ItemStack bottes = new ItemStack(Material.IRON_BOOTS);
		
		bottes.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);

		ItemStack epee = new ItemStack(Material.IRON_SWORD);
		ItemStack ender = new ItemStack(Material.ENDER_PEARL, 25);
		ItemStack torch = new ItemStack(Material.REDSTONE_TORCH_ON);
		ItemMeta torchmeta = torch.getItemMeta();
		torchmeta.setDisplayName(ChatColor.RED + "Téléportation");

		List <String> loretorch = new ArrayList<String>();
		loretorch.add("");
		loretorch.add("§fLe rechargement dure 20s !");
		loretorch.add("");

		torchmeta.setLore(loretorch);
		torch.setItemMeta(torchmeta);

		casque.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 6);
		epee.addEnchantment(Enchantment.KNOCKBACK, 1);
		ItemMeta epeemeta = epee.getItemMeta();
		epeemeta.setDisplayName("§f[§cFlash'Sword§f]");
		epee.setItemMeta(epeemeta);

		p.getInventory().clear();
		p.getInventory().setHelmet(casque);
		p.getInventory().setLeggings(pantalon);
		p.getInventory().setChestplate(plastron);
		p.getInventory().setBoots(bottes);

		p.getInventory().addItem(epee);
		p.getInventory().addItem(torch);
		p.getInventory().addItem(ender);
		Spawn.givesoupe(p);
		
		p.sendMessage("");
		p.sendMessage(Main.name + "Kit: §cFlash§f | Lvl: §cmax§f");
		p.sendMessage("");

		p.setGameMode(GameMode.ADVENTURE);
		p.setHealth(20.0);
		p.setWalkSpeed((float) 0.35);
	}

}
